TASK_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))

include ../config.mk

# Inputs
SRC := $(TASK_DIR)/src/get_realized_risk.R
CONFIG_FILE := $(TASK_DIR)/hand/config.yaml
WINZ_FN := $(TASK_DIR)/../run_regressions/R/generic_helper_functions.R

# Outputs
OUT_FILE := $(OUT_DIR)/realized_risk_by_pathway.csv

$(OUT_FILE): $(SRC) $(TASK_FNS) $(CONFIG_FILE) $(PROJECT_CONFIG) $(XSECTION_ANALYSIS_FILE) $(WINZ_FN)
	@mkdir -p $(OUT_DIR)
	@$(R_script) $(SRC) \
		--CONFIG_FILE=$(CONFIG_FILE) \
		--PROJECT_CONFIG=$(PROJECT_CONFIG) \
		--XSECTION_ANALYSIS_FILE=$(XSECTION_ANALYSIS_FILE) \
		--WINZ_FN=$(WINZ_FN) \
		--OUT_FILE=$(OUT_FILE)

.PHONY: all clean
.DEFAULT_GOAL=all

all: $(OUT_FILE)

clean:
	rm -rf $(OUT_DIR)
